from django.db import models
from django.contrib.auth.models import User
from django.newforms import ModelForm

# Create your models here.
class Presentation(models.Model):
	presenter = models.ForeignKey(User)
	title = models.CharField('Title', max_length=30)
	abstract = models.TextField(
		'Abstract', 
		help_text = 'Abstarct of this presentation',
		blank = True
	)
	date = models.DateField('Create Date', auto_now_add=True)

	class Admin:
		pass;
	
	class Meta:
		ordering = ('-date','presenter')
	
	def get_absolute_url(self):
		return "/seminars/%s/%d/" % (self.date.strftime("%Y/%b/%d").lower(), self.id)

	def __str__(self):
		return self.title
	
	def __unicode__(self):
		return self.title

class PresentationForm(ModelForm):
	class Meta:
		model = Presentation
		exclude = ('presenter',)